Skip to content

Comments

[FEAT] 등록자 확인용 직전 등록 공연 조회 api추가#151

Merged
sweatbuckets merged 1 commit intodevelopfrom
feat/getCreatedShow
Feb 8, 2026
Merged

[FEAT] 등록자 확인용 직전 등록 공연 조회 api추가#151
sweatbuckets merged 1 commit intodevelopfrom
feat/getCreatedShow

Conversation

@sweatbuckets
Copy link
Contributor

@sweatbuckets sweatbuckets commented Feb 8, 2026

  1. #⃣ 연관된 이슈
    • 관련 이슈를 명시해주세요.
    • 예: #이슈번호#이슈번호
  2. 📝 작업 내용
    • 방금 등록한 공연 (미승인) 단건 조회 api
    • 일반 사용자용 단건 조회는 승인된 공연만 보이도록 수정
    • 러닝타임 필드 String에서 Integer로 수정, 형식 고정후 dto에서 일괄적으로 "분" 붙여서 string으로 내려주도록
  3. 📸 스크린샷 (선택)
    • 작업 내용을 시각적으로 표현할 스크린샷을 포함하세요.
  4. 💬 리뷰 요구사항 (선택)
    • 리뷰어가 특히 검토해주었으면 하는 부분이 있다면 작성해주세요.
    • 예: "메서드 XXX의 이름을 더 명확히 하고 싶은데, 좋은 아이디어가 있으신가요?"

Summary by CodeRabbit

Release Notes

  • New Features

    • Performers can now access a dedicated endpoint to retrieve detailed information about their created amateur shows
    • Runtime values in responses now display with time unit indicators (분 for minutes)
  • Improvements

    • Access to amateur shows is now restricted based on approval status for general users
    • Requests for unapproved shows return appropriate error feedback
    • Existing endpoint documentation has been clarified

@coderabbitai
Copy link

coderabbitai bot commented Feb 8, 2026

📝 Walkthrough

Walkthrough

This PR introduces a new performer-scoped endpoint to retrieve created amateur shows with ownership validation, updates the runtime field type from String to Integer across DTOs and entities, adds approval status checking to the existing show retrieval endpoint, and introduces a new error status for non-approved shows.

Changes

Cohort / File(s) Summary
Controller API
src/main/java/cc/backend/amateurShow/controller/AmateurController.java
Added new endpoint GET /created/{amateurShowId} with PERFORMER role authorization to retrieve created shows owned by the authenticated member; updated existing getAmateurShow endpoint's Swagger summary for clarity.
DTO Runtime Type
src/main/java/cc/backend/amateurShow/dto/AmateurEnrollRequestDTO.java, src/main/java/cc/backend/amateurShow/dto/AmateurUpdateRequestDTO.java
Changed runtime field type from String to Integer in both request DTOs to enforce numeric validation at the API boundary.
Entity & Converter
src/main/java/cc/backend/amateurShow/entity/AmateurShow.java, src/main/java/cc/backend/amateurShow/converter/AmateurConverter.java
Updated AmateurShow runtime field from String to Integer; converter now appends "분" unit suffix when converting to response DTO (e.g., 120"120분").
Repository Query
src/main/java/cc/backend/amateurShow/repository/AmateurShowRepository.java
Added new finder method findByIdAndMemberId(Long id, Long memberId) to enable ownership-based show retrieval validation.
Service Layer
src/main/java/cc/backend/amateurShow/service/amateurShowService/AmateurService.java, src/main/java/cc/backend/amateurShow/service/amateurShowService/AmateurServiceImpl.java
Added new service method getCreatedShow(Long memberId, Long amateurShowId) with member ownership validation; updated getAmateurShow to enforce APPROVED status before returning.
Error Handling
src/main/java/cc/backend/apiPayLoad/code/status/ErrorStatus.java
Added new error status NOT_APPROVED_SHOW (AMATEURSHOW4002, FORBIDDEN) for shows in non-approved states.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • PR #105: Adds PERFORMER role enforcement and ownership-based retrieval validation in the amateur show access control layer.
  • PR #135: Modifies amateur show API surface and show retrieval/approval logic with repository query behavior changes.
  • PR #137: Handles approval/rejection states in the amateur show service layer with corresponding entity and response changes.

Suggested reviewers

  • yhi9839

Poem

🐰 A performer's show, now locked with care,
Ownership checked beyond compare.
Runtime in numbers, clear and bright,
Approved or not—the status's might.
The API grows with validation's grace!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main feature: adding an API for creators to view their recently created show, which aligns with the primary changeset.
Description check ✅ Passed The description covers work content including the new API, user-facing changes, and runtime field refactoring, but the related issues section is incomplete with only the template placeholder.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/getCreatedShow

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/java/cc/backend/amateurShow/controller/AmateurController.java (1)

104-109: ⚠️ Potential issue | 🟡 Minor

Pre-existing bug: getShowIncoming delegates to getShowToday.

Line 107 calls amateurService.getShowToday(pageable) instead of what should likely be a dedicated getShowIncoming method. This appears to be a copy-paste error from the /today endpoint. Not introduced by this PR, but worth noting.

🤖 Fix all issues with AI agents
In `@src/main/java/cc/backend/amateurShow/controller/AmateurController.java`:
- Around line 63-70: The service method handling getCreatedShow in
AmateurServiceImpl currently throws ErrorStatus.MEMBER_NOT_PERFORMER when a show
isn't found or isn't owned by the authenticated performer; change that to a
semantically correct status such as ErrorStatus.SHOW_NOT_FOUND or
ErrorStatus.SHOW_NOT_OWNED_BY_MEMBER in the code path that checks
ownership/fetch result (the branch that currently throws MEMBER_NOT_PERFORMER
around the getCreatedShow handling), and update any related exception
construction or messages so the controller AmateurController.getCreatedShow
receives the correct error code.

In `@src/main/java/cc/backend/amateurShow/converter/AmateurConverter.java`:
- Line 274: The builder call in AmateurConverter that sets
.runtime(amateurShow.getRuntime() + "분") will produce "null분" when
amateurShow.getRuntime() is null; change it to conditionally format the value
(e.g., if amateurShow.getRuntime() == null then pass null or an empty string,
otherwise pass amateurShow.getRuntime() + "분") so the runtime field is
omitted/empty instead of "null분"; locate the .runtime(...) invocation in
AmateurConverter and replace the direct concatenation with a null-safe
conditional/ternary or use Optional to format only when getRuntime() is
non-null.
🧹 Nitpick comments (1)
src/main/java/cc/backend/amateurShow/service/amateurShowService/AmateurServiceImpl.java (1)

457-464: Consider using a more precise error when the show is simply not found.

findByIdAndMemberId returns empty for two distinct cases: the show doesn't exist at all, or it belongs to a different member. Throwing MEMBER_NOT_PERFORMER for both conflates "not found" with "not authorized." This could confuse the creator if they pass an invalid show ID—they'd receive a permissions error instead of a 404.

A two-step lookup (find by ID, then verify ownership) would let you return AMATEURSHOW_NOT_FOUND vs. MEMBER_NOT_AUTHORIZED as appropriate.

♻️ Proposed refactor
     `@Override`
     public AmateurShowResponseDTO.AmateurShowResult getCreatedShow(Long memberId, Long amateurShowId){
-        AmateurShow amateurShow =
-                amateurShowRepository.findByIdAndMemberId(amateurShowId, memberId)
-                        .orElseThrow(() -> new GeneralException(ErrorStatus.MEMBER_NOT_PERFORMER));
+        AmateurShow amateurShow = amateurShowRepository.findById(amateurShowId)
+                .orElseThrow(() -> new GeneralException(ErrorStatus.AMATEURSHOW_NOT_FOUND));
+
+        if (!amateurShow.getMember().getId().equals(memberId)) {
+            throw new GeneralException(ErrorStatus.MEMBER_NOT_AUTHORIZED);
+        }

         return AmateurConverter.toResponseDTO(amateurShow);
     }

Comment on lines +63 to +70
@PreAuthorize("hasRole('PERFORMER')")
@GetMapping("/created/{amateurShowId}")
@Operation(summary = "방금 등록한 공연 단건 조회(아직 미승인) - 등록자용")
public ApiResponse<AmateurShowResponseDTO.AmateurShowResult> getCreatedShow(
@AuthenticationPrincipal(expression = "member") Member member,
@PathVariable Long amateurShowId){
return ApiResponse.onSuccess(amateurService.getCreatedShow(member.getId(), amateurShowId));
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

rg -n "getCreatedShow" --type=java -A 15

Repository: SeeATheater/CC_Backend

Length of output: 5440


Fix misleading error code in service layer.

The endpoint is properly secured with @PreAuthorize("hasRole('PERFORMER')") and correctly extracts the authenticated member. However, the service throws ErrorStatus.MEMBER_NOT_PERFORMER when the show isn't found for that member (line 461 in AmateurServiceImpl.java). This error code is semantically incorrect — the member is a performer (they passed the role check); the real issue is the show doesn't exist or isn't owned by that member. Use SHOW_NOT_FOUND or SHOW_NOT_OWNED_BY_MEMBER instead.

🤖 Prompt for AI Agents
In `@src/main/java/cc/backend/amateurShow/controller/AmateurController.java`
around lines 63 - 70, The service method handling getCreatedShow in
AmateurServiceImpl currently throws ErrorStatus.MEMBER_NOT_PERFORMER when a show
isn't found or isn't owned by the authenticated performer; change that to a
semantically correct status such as ErrorStatus.SHOW_NOT_FOUND or
ErrorStatus.SHOW_NOT_OWNED_BY_MEMBER in the code path that checks
ownership/fetch result (the branch that currently throws MEMBER_NOT_PERFORMER
around the getCreatedShow handling), and update any related exception
construction or messages so the controller AmateurController.getCreatedShow
receives the correct error code.

.posterImageUrl(amateurShow.getPosterImageUrl())
.schedule(schedule)
.runtime(amateurShow.getRuntime())
.runtime(amateurShow.getRuntime() + "분")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Null runtime will produce the string "null분".

amateurShow.getRuntime() returns Integer (nullable). When null, the concatenation null + "분" yields "null분" instead of an empty or omitted value.

🐛 Proposed fix
-                .runtime(amateurShow.getRuntime() + "분")
+                .runtime(amateurShow.getRuntime() != null ? amateurShow.getRuntime() + "분" : null)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.runtime(amateurShow.getRuntime() + "분")
.runtime(amateurShow.getRuntime() != null ? amateurShow.getRuntime() + "분" : null)
🤖 Prompt for AI Agents
In `@src/main/java/cc/backend/amateurShow/converter/AmateurConverter.java` at line
274, The builder call in AmateurConverter that sets
.runtime(amateurShow.getRuntime() + "분") will produce "null분" when
amateurShow.getRuntime() is null; change it to conditionally format the value
(e.g., if amateurShow.getRuntime() == null then pass null or an empty string,
otherwise pass amateurShow.getRuntime() + "분") so the runtime field is
omitted/empty instead of "null분"; locate the .runtime(...) invocation in
AmateurConverter and replace the direct concatenation with a null-safe
conditional/ternary or use Optional to format only when getRuntime() is
non-null.

@sweatbuckets sweatbuckets merged commit 8fcd132 into develop Feb 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant